package com.yunji.base.enums;

import lombok.Getter;

import java.util.Objects;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.agent.enums
 * @Title: ScaleTypes
 * @Description: 分成类型
 * <p>
 * History:
 * Date                     Version     Author          Summary
 * ============================================================
 * 2024-04-10 20:22:17      V1.0        HuaAo       新建类
 */
@Getter
public enum ScaleTypes {
    FREE(0, "免费"),
    RATIO(1, "金额比例"),
    FIXED(2, "固定金额"),
    CONTRACT(3, "按年限");
    private final Integer code;
    private final String text;

    ScaleTypes(Integer code, String text) {
        this.code = code;
        this.text = text;
    }

    public static String get(Integer code) {
        ScaleTypes[] enums = ScaleTypes.values();
        for (ScaleTypes e : enums) {
            if (Objects.equals(e.code, code)) {
                return e.text;
            }
        }
        return null;
    }
}
